import request from '@/utils/request'

export default {
  addExpense(expense) {
    return request({
      url: '/expenses',
      method: 'post',
      data: expense
    })
  },
  getExpenseList(searchModel) {
    return request({
      url: '/expenses/list',
      method: 'get',
      params: {
        page: searchModel.page,
        pageSize: searchModel.pageSize,
        name: searchModel.name
      }
    })
  },
  getExpenseById(id) {
    return request({
      url: `/expenses/${id}`,
      method: 'get'
    })
  },
  updateExpense(expense) {
    return request({
      url: '/expenses',
      method: 'put',
      data: expense
    })
  },
  deleteExpense(id) {
    return request({
      // url: '/user/' + id,
      url: `/expenses${id}`,
      method: 'delete'
    })
  },
  updateExpenseById(params) {
    return request({
      url: '/expenses/status',
      method: 'put',
      data: params
    })
  },
  getExpenseListByUser(searchModel) {
    return request({
      url: '/expenses/userList',
      method: 'get',
      params: {
        page: searchModel.page,
        pageSize: searchModel.pageSize
      }
    })
  }
}
